#include <bits/stdc++.h>

using namespace std;

string a[] = {"one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty","a","both","another","first","second","third"};
int b[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1,2,1,1,2,3};
int ans[30] , n;
int main()
{
    string t;
    for(int i=1;i<=6;i++){
        cin>>t;
        for(int j=0;j<26;j++){
            if(t==a[j]){
                ans[++n]=b[j];
                ans[n]*=ans[n];
                ans[n]%=100;
            }
        }
    }
    if(n==0){cout<<0;return 0;}
    sort(ans+1,ans+1+n);
    cout<<ans[1];
    for(int i=2;i<=n;i++){
        if(ans[i]<10)cout<<0;
        cout<<ans[i];
    }
    return 0;
}
